{% load i18n %}
<table
    border="0"
    cellpadding="0"
    cellspacing="0"
    style="background: #00262b; color: white; width: 100%; padding: 1.5rem"
>
    <tbody>
        <tr align="right">
            <td>
                <a href="{{unsubscribe_url}}" rel="noopener noreferrer" target="_blank" style="color: white; text-decoration: none; font-size: 12px; line-height: 10px">
                    {% trans "Unsubscribe" as tmsg %}{{ tmsg | force_escape }}
                </a>
            </td>
        </tr>
        <tr align="center">
            <td>
                <img src="{{ logo_notification_cadence_url }}" style="width: 64px" height="auto" alt="logo_url" />
            </td>
        </tr>
        <tr style="height: 20px"></tr>
        <tr align="center">
            <td style="font-family: Inter, Arial, Verdana, sans-serif; font-size: 32px; font-style: normal; font-weight: 700; line-height: 36px">
                {% if digest_frequency == "Weekly" %}
                    {% trans "Weekly Notifications Digest" as tmsg %}{{ tmsg | force_escape }}
                {% else %}
                    {% trans "Daily Notifications Digest" as tmsg %}{{ tmsg | force_escape }}
                {% endif %}
            </td>
        </tr>
        <tr style="height: 10px"></tr>
        <tr align="center">
            <td
                style="
                    color: #bfc9ca;
                    font-family: Inter, Arial, Verdana, sans-serif;
                    font-size: 14px;
                    font-style: normal;
                    font-weight: 400;
                    line-height: 28px;
                "
            >
                {{ start_date }} {% if digest_frequency == "Weekly" %} - {{ end_date }} {% endif %}
            </td>
        </tr>
        <tr style="height: 24px"></tr>
        <tr align="center">
            <td>
                <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
                    <tbody>
                        <tr>
                            {% for update in email_digest_updates %}
                            <td width="33.33%" style="padding: 0.5rem;">
                                    <table width="100%" cellpadding="0" cellspacing="0" style="background: #1b3b40; color: white; border-radius: 8px; padding: 1.25rem 1rem;">
                                        <tbody>
                                            <tr align="center">
                                                <td style="font-weight: 700; font-size: 32px; line-height: 44px; padding: 0">
                                                    {{update.count}}
                                                </td>
                                            </tr>
                                            <tr align="center">
                                                <td style="font-weight: 600; font-size: 14px; line-height: 20px; padding: 0">
                                                    {{update.translated_title}}
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                            </td>
                            {% if forloop.counter|divisibleby:3 %}
                            </tr><tr> <!-- Close the row after every third td -->
                            {% endif %}
                        {% endfor %}
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
